]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: Remove semi-complex primary device finding
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 29 Apr 2013 17:09:01 +0000 (13:09 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Wed, 15 May 2013 15:13:11 +0000 (11:13 -0400)
According to dcbw (and some updated documentation), there will
always be a 1:1 correspondence between NMActiveConnection and
an NMDevice.

https://bugzilla.gnome.org/show_bug.cgi?id=700322

js/ui/status/network.js

index 6df61c3c685c010d744f80d76866d92be3724dce..de4444a9e97b9189f535df8a56d2c29a8d5296dd 100644 (file)
@@ -1946,18 +1946,10 @@ const NMApplet = new Lang.Class({
                 active_vpn = a;
 
             if (!a._primaryDevice) {
-                if (a._type != NetworkManager.SETTING_VPN_SETTING_NAME) {
-                    // find a good device to be considered primary
-                    a._primaryDevice = null;
-                    let devices = a.get_devices() || [];
-                    for (let j = 0; j < devices.length; j++) {
-                        let d = devices[j];
-                        if (d._delegate) {
-                            a._primaryDevice = d._delegate;
-                            break;
-                        }
-                    }
-                } else
+                if (a._type != NetworkManager.SETTING_VPN_SETTING_NAME)
+                    // This list is guaranteed to have one device in it.
+                    a._primaryDevice = a.get_devices()[0]._delegate;
+                else
                     a._primaryDevice = this._vpnSection;
 
                 if (a._primaryDevice)